#ifndef SWP_SWIMLANE_GRAPHIC_ITEM_CONTENT_H
#define SWP_SWIMLANE_GRAPHIC_ITEM_CONTENT_H

#include <igraphicitemcontent.h>

#include <QtGui/QGraphicsRectItem>

namespace swp
{

class SwpSwimlaneGraphicItemContent : public QGraphicsRectItem,
    public core::IGraphicItemContent
{
public:
    SwpSwimlaneGraphicItemContent(const QString& swimlaneName,
        QGraphicsItem* parent = 0);
    ~SwpSwimlaneGraphicItemContent();

    void setSwimlaneName(const QString& activityName);
    QString swimlaneName() const;

    // IGraphicItemContent
    QGraphicsItem* graphicsItem() const;
    void drawThumbnail(QPainter& painter, const QRectF& boundingRect);
    QRectF croppedBoundingRect() const;
    void recheckIfFits();
    void setPalette(const core::Palette* const palette);

    // ISerializable
    bool doActionForProperty(const QString& property,
        const QVariantList& value, const core::SerializationEngine& helper);
    void deserializationFinished(bool ok);
    QHash<QString, QVariantList> serializationData(
        const core::SerializationEngine& helper) const;

    void paint(QPainter* painter, const QStyleOptionGraphicsItem* option,
        QWidget* widget);
    QRectF boundingRect() const;

private:
    void relayout();
    void elide(qreal width);

private:
    QString m_name;
    QGraphicsSimpleTextItem* m_nameItem;
    bool m_cropped;
    QColor m_border;
    QColor m_background;
};

} // namespace swp

#endif
